package com.api.shopapi.mapper;

import com.api.shopapi.entity.LXXueYaJi;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface LXXueYaJiMapper {

    @Insert("insert into lx_xueyaji " +
            "(" +
            "LXXueYaJiCode, " +
            "UserCode, " +
            "DeviceId, " +
            "DiastolicPressure, " +
            "SystolicPressure, " +
            "HeartRate, " +
            "IrregularHeartbeat, " +
            "MovementError, " +
            "UserNo, " +
            "MeasurementDate" +
            ") " +
            "VALUES " +
            "(" +
            "#{lxXueYaJi.LXXueYaJiCode} ," +
            "#{lxXueYaJi.UserCode} ," +
            "#{lxXueYaJi.DeviceId} ," +
            "#{lxXueYaJi.DiastolicPressure} ," +
            "#{lxXueYaJi.SystolicPressure}," +
            "#{lxXueYaJi.HeartRate} ," +
            "#{lxXueYaJi.IrregularHeartbeat} ," +
            "#{lxXueYaJi.MovementError} ," +
            "#{lxXueYaJi.UserNo} ," +
            "#{lxXueYaJi.MeasurementDate}  ) ")
    int insert(@Param("lxXueYaJi") LXXueYaJi lxXueYaJi);


    @Select("select * from lx_xueyaji where UserCode=#{userCode}  order by MeasurementDate desc  ")
    List<LXXueYaJi> geyByUserCode(@Param("userCode") String userCode);





}
